Refactor CPU feature detection to use an explicit x86 whitelist#258
Refactor CPU feature detection to use an explicit x86 whitelist#258ihb2032 wants to merge 6 commits intoalibaba:mainfrom
Conversation
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
…itelist Currently, `cpu_features.cc` assumes any non-ARM architecture is x86/x64, which leads to a fatal missing `<cpuid.h>` error on architectures like RISC-V. This commit refactors the preprocessor macros to explicitly whitelist x86 architectures (`__x86_64__`, `__i386__`, `_M_X64`, `_M_IX86`). All other architectures (RISC-V, ARM, etc.) will now safely fall back to the default zero-initialization, allowing cross-compilation to succeed. Signed-off-by: ihb2032 <hebome@foxmail.com>
2192b65 to
061258b
Compare
061258b to
5d725df
Compare
Introduce the RISC-V CI runner provided by the RISE project. This enables automated testing and building for the RISC-V architecture. Signed-off-by: ihb2032 <hebome@foxmail.com>
5d725df to
6040065
Compare
|
@ihb2032 please take a look at this error: https://github.com/alibaba/zvec/actions/runs/24500696519/job/71607486150 Seems the ci job can be brought up after Github App was setup. Any problem, let me know. |
|
Hi @richyreachy, thanks for pointing that out! I checked the logs and the issue is that To fix this without breaking the other builds that share I've just pushed the fix, let's see if the CI turns green! |
7549f02 to
777a546
Compare
Signed-off-by: ihb2032 <hebome@foxmail.com>
777a546 to
a0dbfc8
Compare
Signed-off-by: ihb2032 <hebome@foxmail.com>
Signed-off-by: ihb2032 <hebome@foxmail.com>
Currently, cpu_features.cc assumes that any architecture that is not __ARM_ARCH must be an x86/x64 architecture and attempts to include <cpuid.h>. This causes fatal compilation errors on other architectures like RISC-V.
Changes Proposed
This PR refactors the preprocessor directives to use an explicit "whitelist" approach:
Motivation
This resolves build failures on RISC-V environments and sets up a clean, safe foundation for potentially adding architecture-specific optimizations in the future.
closed #244